<?php
require_once '../include.php';
$username=$_POST['username'];
//转义，防止sql注入
$username=addslashes($username);
$password=md5($_POST['password']);
//print_r($username);
    $sql = "select * from imooc_admin where username='{$username}' and password='{$password}'";
    $row = checkAdmin($sql);
    if ($row){

        $_SESSION['adminName'] = $row['username'];
        $_SESSION['adminId']=$row['id'];
        //跳转到主页
        //header("location:index.php");
        alertMes("登录成功", 'index.php');
    }else {
        alertMes("登录失败，重新登录", 'login.php');
    }












